// LightDialog.cpp : implementation file
//

#include "stdafx.h"
#include "test.h"
#include "LightDialog.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CLightDialog dialog


CLightDialog::CLightDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CLightDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(CLightDialog)
	m_x = 0.0f;
	m_y = 0.0f;
	m_z = 0.0f;
	m_linearAtt = 0.0f;
	m_quadAtt = 0.0f;
	m_constAtt = 0.0f;
	m_angle = 0.0f;
	m_color = 0;
	//}}AFX_DATA_INIT
}


void CLightDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CLightDialog)
	DDX_Text(pDX, IDC_EDIT_X, m_x);
	DDX_Text(pDX, IDC_EDITY, m_y);
	DDX_Text(pDX, IDC_EDITZ, m_z);
	DDX_Text(pDX, IDC_LINEAR_ATT, m_linearAtt);
	DDX_Text(pDX, IDC_QUAD_ATT, m_quadAtt);
	DDX_Text(pDX, IDC_CONSTANT_ATT, m_constAtt);
	DDX_Text(pDX, IDC_ANGLE, m_angle);
	DDV_MinMaxFloat(pDX, m_angle, 0.f, 180.f);
	DDX_Text(pDX, IDC_COLOR, m_color);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CLightDialog, CDialog)
	//{{AFX_MSG_MAP(CLightDialog)
	ON_BN_CLICKED(IDC_AMBIENT, OnAmbient)
	ON_BN_CLICKED(IDC_POSITIONAL, OnPositional)
	ON_BN_CLICKED(IDC_PARALLELL, OnParallell)
	ON_BN_CLICKED(IDC_SPOTLIGHT, OnSpotlight)
	ON_BN_CLICKED(IDC_BROWSE_COLOR, OnBrowseColor)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLightDialog message handlers

void CLightDialog::OnAmbient() 
{
	tipo=AMBIENTE;
	
}

void CLightDialog::OnPositional() 
{
	tipo=POSICIONAL;
	
}

void CLightDialog::OnParallell() 
{
	tipo=PARALELO;
	
}

void CLightDialog::OnSpotlight() 
{
	tipo=SPOT;
	
}

void CLightDialog::OnBrowseColor() 
{
	CColorDialog dlg;
	dlg.DoModal();
	color=dlg.GetColor();
	edit->m_color=color;
	edit->Invalidate();
}

BOOL CLightDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	edit=new CEditColor();
	edit->SubclassDlgItem(IDC_COLOR,this);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
